import request from '@/utils/request'
import {ElMessage} from 'element-plus'

function get(url, params) {
    return request.get(
        url,
        {params}
    ).catch(error => {
        ElMessage.error(error)
    });
}

function postJson(url, data) {
    return request.post(
        url,
        data,
        {
            headers: {
                'Content-Type': 'application/json'
            }
        }
    ).catch(error => {
        ElMessage.error(error)
    });
}

export function login(data){
    return postJson("/auth/login", data).then(res => res.data);
}

export function checkLogin(){
    return postJson("/auth/checkLogin").then(res => res.data);
}
